import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
const store = new Vuex.Store({
	state: {
		userInfo: uni.getStorageSync('userInfo') || {
			openId: '',
			memberId: '',
			nickname: '',
			headimgurl: '',
			subscribe: '',
			sex: ''
		},
		orderInfo: uni.getStorageSync('orderInfo') || {
			lineDetail: {},
			orderDetail: {}
		},
		outingOrderInfo: uni.getStorageSync('outingOrderInfo') || {
			outingDetail: {},
			orderDetail: {}
		},
		token: uni.getStorageSync('token') || '',
		historyList: uni.getStorageSync('storage_historyList') || [],
		localName: '杭州',
		// proxyUrl: 'https://app73551.eapps.dingtalkcloud.com', // 线上环境，主要不要随意修改数据
		proxyUrl:'https://outing-dingtalk.lishicloud.com',//测试环境域名
		// proxyUrl:'https://outing-dingtalk.test.lishicloud.com',//开发环境域名
		// proxyUrl: 'http://192.168.2.24:17189',
		faceValue: 50, // 表示快乐券面值
		storeCity: uni.getStorageSync('storage_city') || '',
		linkOrderNo: '',
    searchForm: {},
    storeLocation: uni.getStorageSync('storage_location') || [],
    cList: [],//钉钉发福利抄送人
    cListimg: []
	},
	mutations: {
    changeCList(state, cList){
      state.cList = cList
    },
    changeCListimg(state,cListimg){
      state.cListimg = cListimg
    },
		changeUserInfo(state, userInfo) {
			state.userInfo = userInfo;
		},
		changeToken(state, token) {
			state.token = token;
			uni.setStorageSync('token', token);
		},
		changeOrderInfo(state, orderInfo) {
			state.orderInfo = orderInfo;
		},
		changeOutingOrderInfo(state, outingOrderInfo) {
			state.outingOrderInfo = outingOrderInfo;
		},
		changeHistoryList(state, historyList) {
			state.historyList = historyList;
			uni.setStorageSync('storage_historyList', historyList);
		},
		changeStoreCity(state, storeCity) {
			state.storeCity = storeCity;
			uni.setStorageSync('storage_city', storeCity);
		},
		changeLocalName(state, localName) {
			state.localName = localName;
		},
		changeLinkOrderNo(state, val) {
			state.linkOrderNo = val;
		},
    changeSearchForm(state, val) {
			state.searchForm = val;
		},
    changeStoreLocation(state, val) {
			state.storeLocation = val;
			uni.setStorageSync('storage_location', val);
    }
	},
	actions: {}
});

export default store;
